Liveness Check SDK
The library belongs to the silent live recognition, user does not need to open his mouth, raise his head and other actions
Environment configuration
The minSdkVersion compiled by the SDK is 21, and the targetSdkVersion is 29. If it conflicts with other plugin libraries, please contact us to modify
① First add engine-release.aar to the libs folder in the module, and then configure the dependency rules in build.gradle in the module
repositories {
flatDir {
dirs 'libs'
}
}
dependencies{
implementation (name: 'engine-release', ext: 'aar');
}
② The SDK needs to rely on the library of Gson, Okhttp and kotlin. If it has been referenced, please ignore it. If there is an error such as a version conflict with the project, please contact us to modify it
implementation 'com.squareup.okhttp3:okhttp:3.12.0'
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.7'
Permissions
The SDK relies on certain permissions, which have declared in aar, but need to be declared separately. It will check whether there is permission. The specific permissions that need to be used are as follows:
android.permission.ACCESSNETWORKSTATE
android.permission.CAMERA
android.permission.WRITEEXTERNALSTORAGE
android.permission.READEXTERNALSTORAGE
android.permission.INTERNET
Liveness Detection
Note that the SDK will not automatically apply for permissions. Please apply for the CAMERA permission before performing the following process.The onSuccess method is the callback of the success of the liveness detection, and the value is the path of the face image returned after the liveness detection is successful
SDK.getInstance(DemoActivity.this) .setSDK_aesKey("xxx") //Obtained after applying for an account, required
.setSDK_token("xxx") //Obtained after applying for an account, required .setSDK_iv("xxx") //Obtained after applying for an account, required .setAppName("xxx") //Obtained after applying for an account, required .setUid("xxx") //Custom user Uid, not required
.toLiveness(new LivenessResultListener() {
@Override public void onSuccess(String value) {
// Here is the path of the face image after the liveness detection
tv_result.setText("success: " + value);
}
@Override
public void onFailed(String message) {
tv_result.setText("error: " + message);
}
});